package tj.eskhata.pos;

import java.io.Serializable;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.apache.wicket.PageParameters;
import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.list.*;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.RefreshingView;
import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.hibernate.SessionFactory;

import tj.eskhata.pos.common.*;
import tj.eskhata.pos.examples.*;
import tj.eskhata.pos.services.PosService;
import tj.eskhata.pos.domain.*;
import tj.eskhata.pos.web.BasePage;
import tj.eskhata.pos.web.account.SigninPage;
import tj.eskhata.pos.web.model.*;

//import org.apache.wicket.Component.*;
/**
 * Homepage
 */
public class HomePage extends BasePage {
	
	private static final long serialVersionUID = 1L;
	private SessionFactory sf;

	public class MenuItem implements Serializable {
	    private String caption;
	    private Class destination;
	  }

    /**
	 * Constructor that is invoked when page is invoked without a session.
	 * 
	 * @param parameters
	 *            Page parameters
	 */
    public HomePage(final PageParameters parameters) {
    	
    	/*String msg;
        // Add the simplest type of label
    	User user=WiaSession.get().getUser();
    	if(user!=null)
    		msg="Good Day Mr. "+user.getFullname();
    	else
    		msg="If you see this message wicket is properly configured and running";
    	
    	final Label lbl=new Label("message", msg);
          */      
        //add(new BookmarkablePageLink("link1",SigninPage.class));
        //add(new BookmarkablePageLink("link2",Page2.class));
        //lbl.setOutputMarkupId(true);
        /*add(new AjaxFallbackLink("changetext"){
        	@Override
        	public void onClick(AjaxRequestTarget target)
        	{
        		//Label lbl=new Label("message", "it's Ajax injection!");
        		if(target != null) 
        			target.addComponent(lbl);
        	}
        });
        add(lbl);
        */
     // java, in e.g. constructor of page
       /* List<MenuItem> menu = createMenu();

        ListView lv = new ListView("menu",menu){
	        @Override
        	protected void populateItem(ListItem item) {
	        	MenuItem menuitem = (MenuItem)item.getModelObject();
	          BookmarkablePageLink link = new BookmarkablePageLink("link",
	              menuitem.destination);
	          link.add(new Label("caption", menuitem.caption));
	          item.add(link);
	        }
        };
        add(lv);
        */
        ///////////////////////////////////
        
    }
    /*
    private List<MenuItem> createMenu() {
        List<MenuItem> menu = new ArrayList<MenuItem>();
        
        MenuItem item = new MenuItem();
        item.caption = "Home";
        item.destination = Output.class;
        menu.add(item);

        item = new MenuItem();
        item.caption = "Cheeses";
        item.destination = Output.class;
        menu.add(item);

        item = new MenuItem();
        item.caption = "Wines";
        item.destination = Output.class;
        menu.add(item);

        item = new MenuItem();
        item.caption = "Recipes";
        item.destination = Output.class;
        menu.add(item);
        return menu;
      }
      */
}
